@model WalkingTec.Mvvm.Doc.ViewModels.MajorVms.MajorVm

<wt:fieldset field-set-style="Simple" title="Textbox">
 </wt:fieldset>
   <p>Textbox的常用属性有：</p>
        <table lay-filter="parse-table-demo">
            <thead>
                <tr>
                    <th lay-data="{field:'username', width:200}">属性</th>
                    <th lay-data="{field:'joinTime', width:600}">描述</th>
                </tr>
            </thead>
            <tbody>
                <tr>
                    <td>Id</td>
                    <td>控件Id，默认根据绑定字段名称生成</td>
                </tr>
                <tr>
                    <td>Field</td>
                    <td>绑定字段，必填</td>
                </tr>
                <tr>
                    <td>Disabled</td>
                    <td>是否禁用</td>
                </tr>
                <tr>
                    <td>Name</td>
                    <td>控件Name，默认根据绑定字段名称生成</td>
                </tr>
                <tr>
                    <td>LabelText</td>
                    <td>标签内容</td>
                </tr>
                <tr>
                    <td>LabelWidth</td>
                    <td>标签的长度，默认为80</td>
                </tr>
                <tr>
                    <td>HideLabel</td>
                    <td>是否隐藏标签</td>
                </tr>
                <tr>
                    <td>EmptyText</td>
                    <td>无数据时显示的提示文本</td>
                </tr>
                <tr>
                    <td>DefaultValue</td>
                    <td>默认值，如果有值则忽略绑定字段的值</td>
                </tr>
                <tr>
                    <td>IsPassword</td>
                    <td>是否是密码字段</td>
                </tr>
                <tr>
                    <td>SearchUrl</td>
                    <td>查询地址，当设置此地址时，textbox会变成自动补全模式</td>
                </tr>
            </tbody>
        </table>
    <div style="height:10px;">&nbsp;</div>
        <wt:tab>
            <wt:tabheaders>
                <wt:tabheader title="效果" />
                <wt:tabheader title="代码" />
            </wt:tabheaders>
            <wt:tabcontents>
                <wt:tabcontent>
                    <wt:form vm="@Model" style="max-width:600px;">
                        <wt:textbox field="Entity.MajorCode" />
                        <wt:textbox field="Entity.MajorName" />
                        <wt:row align="AlignEnum.Right">
                            <wt:submitbutton disabled="true" />
                            <wt:closebutton disabled="true" />
                        </wt:row>
                    </wt:form>
                </wt:tabcontent>
                <wt:tabcontent>
                    <wt:code>
&ltwt:form vm="@@Model" width="600"&gt
    &ltwt:textbox field="Entity.MajorCode" /&gt
    &ltwt:textbox field="Entity.MajorName" /&gt
    &ltwt:row align="AlignEnum.Right"&gt
        &ltwt:submitbutton disabled="true" /&gt
        &ltwt:closebutton disabled="true" /&gt
    &lt/wt:row&gt
&lt/wt:form&gt
                    </wt:code>
                </wt:tabcontent>
            </wt:tabcontents>
        </wt:tab>

<wt:fieldset field-set-style="Simple" title="AutoComplete">
 </wt:fieldset>
   <wt:quote>
        <p>Textbox可以开启自动补全功能，方法是设置SearchUrl</p>
        <p>该Url接受一个名为keywords的参数，返回Text,Value数组形式的json</p>
    </wt:quote>
    <wt:tab>
        <wt:tabheaders>
            <wt:tabheader title="效果" />
            <wt:tabheader title="代码" />
        </wt:tabheaders>
        <wt:tabcontents>
            <wt:tabcontent>
                <wt:display display-text="在所属学校中试试搜索北京，清华，复旦，浙江"/>
                <wt:form vm="@Model" style="max-width:600px;">
                    <wt:textbox field="Entity.MajorCode" />
                    <wt:textbox field="Entity.MajorName" />
                    <wt:textbox field="SchoolName" label-text="所属学校" search-url="/UI/GetSchool" />
                    <wt:row align="AlignEnum.Right">
                        <wt:submitbutton disabled="true" />
                        <wt:closebutton disabled="true" />
                    </wt:row>
                </wt:form>
            </wt:tabcontent>
            <wt:tabcontent>
                <wt:code>
&ltwt:form vm="@@Model" width="600"&gt
    &ltwt:textbox field="Entity.MajorCode" /&gt
    &ltwt:textbox field="Entity.MajorName" /&gt
    &ltwt:textbox field="SchoolName" label-text="所属学校" search-url="/UI/GetSchool" /&gt
    &ltwt:row align="AlignEnum.Right"&gt
        &ltwt:submitbutton disabled="true" /&gt
        &ltwt:closebutton disabled="true" /&gt
    &lt/wt:row&gt
&lt/wt:form&gt
                </wt:code>
                <wt:code title="/UI/GetSchool">
public IActionResult GetSchool(string keywords)
{
    List&ltSchool&gt schools = new List&ltSchool&gt()
    {
        new School { SchoolName = "清华大学"},
        new School { SchoolName = "北京大学"},
        new School { SchoolName = "复旦大学"},
        new School { SchoolName = "北京工业大学"},
        new School { SchoolName = "浙江大学"},
    };
    var rv = schools.Where(x=&gtx.SchoolName.StartsWith(keywords)).Select(x =&gt new { Text = x.SchoolName, Value = x.SchoolName }).ToList();
    return Json(rv);
}

                </wt:code>
            </wt:tabcontent>
        </wt:tabcontents>
    </wt:tab>

    <script>
    layui.use('code',function(){layui.code({ about: false })})
        layui.table.init('parse-table-demo', {
        limit: 100, page: false
        });
    </script>
<script>
  $("#@Model.ViewDivId").parent().css("height", "auto");
</script>
